package com.cytech.cloudclinic.adapter;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.cytech.cloudclinic.R;
import com.cytech.cloudclinic.bean.CaseInfo;
import com.cytech.cloudclinic.utils.ImageUtils;

import java.util.List;

public class CaseInfoAdapter extends BaseQuickAdapter<CaseInfo, BaseViewHolder> {

    public CaseInfoAdapter(List<CaseInfo> data) {
        super(R.layout.item_patient_case_info, data);
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, CaseInfo caseInfo) {
        RecyclerView recyclerView = baseViewHolder.getView(R.id.rv_case_prescription);
        recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
        PrescriptionAdapter prescriptionAdapter = new PrescriptionAdapter(caseInfo.drugs);
        recyclerView.setAdapter(prescriptionAdapter);

        baseViewHolder.setText(R.id.item_case_time,caseInfo.create_time);
        baseViewHolder.setText(R.id.item_case_no,"处方编号:"+caseInfo.prescription_id);
        baseViewHolder.setText(R.id.item_case_pre_history,caseInfo.action);

        baseViewHolder.setText(R.id.et_add_patient_diagnosis,caseInfo.diagnose);

        baseViewHolder.setText(R.id.et_add_patient_history,caseInfo.previous_history);
        baseViewHolder.setText(R.id.et_add_patient_allergy,caseInfo.allergic_history);

        baseViewHolder.setText(R.id.tv_add_patient_price,String.valueOf(caseInfo.prescrioption_price));

        ImageUtils.show(getContext(),baseViewHolder.getView(R.id.iv_add_patient_tongue1),caseInfo.tongue_img_1);
        ImageUtils.show(getContext(),baseViewHolder.getView(R.id.iv_add_patient_tongue2),caseInfo.tongue_img_2);
        ImageUtils.show(getContext(),baseViewHolder.getView(R.id.iv_add_patient_check_list),caseInfo.checklist_img);

    }
}
